package edu.pku.sei.act.main.palette;

import java.util.ArrayList;
import java.util.List;

import edu.pku.sei.act.images.ArchiModelImageProvider;
import edu.pku.sei.act.model.common.ArchiModelConst;
import edu.pku.sei.gmp.editor.palette.GMPEntryDescriptor;
import edu.pku.sei.gmp.editor.palette.GMPEntryType;
import edu.pku.sei.gmp.editor.palette.GMPPaletteFactory;
import edu.pku.sei.gmp.model.common.GMPModel;

public class ArchiModelerPaletteFactory extends GMPPaletteFactory {

	public ArchiModelerPaletteFactory(GMPModel model) {
		super(model);
	}

	@Override
	protected List<GMPEntryDescriptor> getEntryList(String diagramType) {
		if (diagramType.equals(ArchiModelConst.__ARCHIMODELDIAGRAM__)) {
			List<GMPEntryDescriptor> desc = new ArrayList<GMPEntryDescriptor>();
			GMPEntryDescriptor entry = new GMPEntryDescriptor();
			entry.elementType = ArchiModelConst.__MOTE__;
			entry.label = "Mote";
			entry.shortDesc = "Create a Mote";
			entry.iconSmall = ArchiModelImageProvider 
					.getImageDescriptor(ArchiModelImageProvider.MOTE);
			entry.entryType = GMPEntryType.NODE;
			desc.add(entry);

			entry = new GMPEntryDescriptor();
			entry.elementType = ArchiModelConst.__DATA__;
			entry.label = "Data";
			entry.shortDesc = "Create a Data";
			entry.iconSmall = ArchiModelImageProvider
					.getImageDescriptor(ArchiModelImageProvider.DATA);
			entry.entryType = GMPEntryType.NODE;
			desc.add(entry);

			entry = new GMPEntryDescriptor();
			entry.elementType = ArchiModelConst.__RADIO__;
			entry.label = "Radio";
			entry.shortDesc = "Create a Radio";
			entry.iconSmall = ArchiModelImageProvider
					.getImageDescriptor(ArchiModelImageProvider.RADIO);
			entry.entryType = GMPEntryType.NODE;
			desc.add(entry);

			entry = new GMPEntryDescriptor();
			entry.elementType = ArchiModelConst.__TIMER__;
			entry.label = "Timer";
			entry.shortDesc = "Create a Tmier";
			entry.iconSmall = ArchiModelImageProvider
					.getImageDescriptor(ArchiModelImageProvider.TIMER);
			entry.entryType = GMPEntryType.NODE;
			desc.add(entry);

			entry = new GMPEntryDescriptor();
			entry.elementType = ArchiModelConst.__SIMPLEDEVICE__;
			entry.label = "SimpleDevice";
			entry.shortDesc = "Create a SimepleDevice";
			entry.iconSmall = ArchiModelImageProvider
					.getImageDescriptor(ArchiModelImageProvider.SIMPLEDEVICE);
			entry.entryType = GMPEntryType.NODE;
			desc.add(entry);

			entry = new GMPEntryDescriptor();
			entry.elementType = ArchiModelConst.__LIP__;
			entry.label = "LIP";
			entry.shortDesc = "Create a LIP";
			entry.iconSmall = ArchiModelImageProvider
					.getImageDescriptor(ArchiModelImageProvider.LIP);
			entry.entryType = GMPEntryType.NODE;
			desc.add(entry);

			entry = new GMPEntryDescriptor();
			entry.elementType = ArchiModelConst.__TASK__;
			entry.label = "TASK";
			entry.shortDesc = "Create a TASK";
			entry.iconSmall = ArchiModelImageProvider
					.getImageDescriptor(ArchiModelImageProvider.TASK);
			entry.entryType = GMPEntryType.NODE;
			desc.add(entry);

			return desc;

		} else {
			return null;
		}

	}
}
